import { request } from "@utils/request.js";

// 获取用户列表
export function getUserList(params) {
    return request({
        url: `user/users`,
        method: 'GET',
        params
    })
}

// 添加用户
export function addUser(data) {
    console.log(data)
    return request({
        url: `user/users/`,
        method: 'POST',
        data
    })
}

// 获取个人信息
export function getUserCenterInfo() {
    return request({
        url: `user/info_center`,
        method: 'GET',
    })
}

// 修改个人信息
export function updateUserCenterInfo(data) {
    return request({
        url: `user/info_center/`,
        method: 'PUT',
        data
    })
}

// 获取用户信息
export function getUserInfo(id) {
    return request({
        url: `user/users/${id}`,
        method: 'GET',
    })
}

// 修改用户
export function updateUserInfo(userId, data) {
    return request({
        url: `user/users/${userId}/`,
        method: 'PATCH',
        data
    })
}

// 删除用户
export function deleteUser(id) {
    return request({
        url: `user/users/${id}`,
        method: 'DELETE',
    })
}

// 刷新token
export function refreshToken(data) {
    return request({
        url: `user/token/refresh/`,
        method: 'POST',
        data
    })
}

// 修改密码
export function editPwd(data) {
    return request({
        url: `user/modify_pwd/`,
        method: 'POST',
        data
    })
}

// 验证token
export function verifyToken(data) {
    return request({
        url: `user/token/verify/`,
        method: 'POST',
        data
    })
}